<div  class="add-new">
	
		<?php echo $this->Html->link($this->Html->image('add-new.png').'Add New', array('action' => 'add'),array('class'=>'shortcut','escape' => false)); ?>
		
</div>

<div class="paidAds index">
	<h2><?php echo __('Paid Ads'); ?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th><?php echo $this->Paginator->sort('id'); ?></th>
			<th><?php echo $this->Paginator->sort('title'); ?></th>
			<th><?php echo $this->Paginator->sort('banner'); ?></th>
			<th><?php echo $this->Paginator->sort('position'); ?></th>
			<th><?php echo $this->Paginator->sort('paid_user_id'); ?></th>
                        <th><?php echo $this->Paginator->sort('link'); ?></th>
                        <th><?php echo $this->Paginator->sort('expired'); ?></th>
			<th class="actions"><?php echo __('Actions'); ?></th>
	</tr>
	<?php foreach ($paidAds as $paidAd): ?>
	<tr>
		<td><?php echo h($paidAd['PaidAd']['id']); ?>&nbsp;</td>
		<td><?php echo h($paidAd['PaidAd']['title']); ?>&nbsp;</td>
		<td><?php echo '<img src="'.$this->webroot.'img/advertises/'.h($paidAd['PaidAd']['banner']).'" width="200px"/>'; ?>&nbsp;</td>
		<td><?php echo h($paidAd['PaidAd']['position']); ?>&nbsp;</td>
		<td>
			<?php echo $this->Html->link($paidAd['PaidUser']['username'], array('controller' => 'paid_users', 'action' => 'view', $paidAd['PaidUser']['id'])); ?>
		</td>
                <td>
                    <?php echo h($paidAd['PaidAd']['link']); ?>&nbsp;
                </td>
                <td>
                    <?php echo h($paidAd['PaidAd']['expired']); ?>&nbsp;
                </td>
		<td class="actions">
                    <?php echo $this->Html->link($this->Html->image('view.png'), array('action' => 'view', $paidAd['PaidAd']['id']),array('class'=>'shortcut','escape' => false)); ?>
                    <?php echo $this->Html->link($this->Html->image('edit.png'), array('action' => 'edit', $paidAd['PaidAd']['id']),array('class'=>'shortcut','escape' => false)); ?>
                    <?php  
                        echo $this->Form->postLink($this->Html->image('delete.png',
                         array("alt" => __('Delete'), "title" => __('Delete'))), 
                         array('action' => 'delete', $paidAd['PaidAd']['id']), 
                         array('escape' => false, 'confirm' => __('Are you sure?')));?>
                    
                    <?php 
                        $myDate = date("Y-m-d");
                        if($paidAd['PaidAd']['expired'] < $myDate) {
                            echo $this->Html->link($this->Html->image('renew.png'), array('action' => 'expired', $paidAd['PaidAd']['id']),array('class'=>'shortcut', 'escape' => false, 'title' => 'Re-new')); 
                        }
                    ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
	));
	?>	</p>
	<div class="paging">
	<?php
		echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
		echo $this->Paginator->numbers(array('separator' => ''));
		echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
	</div>
</div>
